﻿
namespace Microsoft.Xna.Framework.Graphics
{
	/// <summary>
	/// Represents a 3D volume of texels.
	/// </summary>
	public class Texture3D : Texture
	{
		#region Properties
		/// <summary>
		/// Gets the depth of this volume texture resource, in pixels.
		/// </summary>
		public int Depth { get; private set; }

		/// <summary>
		/// Gets the height of this texture resource, in pixels.
		/// </summary>
		public int Height { get; private set; }

		/// <summary>
		/// Gets the width of this texture resource, in pixels.
		/// </summary>
		public int Width { get; private set; }
		#endregion

		#region Constructor
		/// <summary>
		/// Creates a new instance of this object.
		/// </summary>
		/// <param name="graphicsDevice">A device.</param>
		/// <param name="width">Texture width.</param>
		/// <param name="height">Texture height.</param>
		/// <param name="depth">Texture depth.</param>
		/// <param name="mipMap">True to generate a full mipmap chain; otherwise, false.</param>
		/// <param name="format">Data format.</param>
		public Texture3D(GraphicsDevice graphicsDevice, int width, int height, int depth, bool mipMap, SurfaceFormat format)
		{
			base.GraphicsDevice = graphicsDevice;
			this.Width = width;
			this.Height = height;
			this.Depth = depth;

			//! TODO: if possible, implement remainder
		}
		#endregion

		#region Public Methods
		/// <summary>
		/// Gets a copy of 3D texture data.
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="data">Array of data.</param>
		public void GetData<T>(T[] data) where T : struct
		{
			int length;
			if (data != null)
			{
				length = data.Length;
			}
			else
			{
				length = 0;
			}
			this.GetData<T>(0, 0, 0, this.Width, this.Height, 0, this.Depth, data, 0, length);
		}

		/// <summary>
		/// Gets a copy of 3D texture data, specifying a start index and number of elements.
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="data">Array of data.</param>
		/// <param name="startIndex">Index of the first element to get.</param>
		/// <param name="elementCount">Number of elements to get.</param>
		public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
		{
			this.GetData<T>(0, 0, 0, this.Width, this.Height, 0, this.Depth, data, startIndex, elementCount);
		}

		/// <summary>
		/// Gets a copy of 3D texture data, specifying a mimap level, source rectangle, start index, and number of elements.
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="level">Mipmap level.</param>
		/// <param name="left">Position of the left side of the box on the x-axis.</param>
		/// <param name="top">Position of the top of the box on the y-axis.</param>
		/// <param name="right">Position of the right side of the box on the x-axis.</param>
		/// <param name="bottom">Position of the bottom of the box on the y-axis.</param>
		/// <param name="front">Position of the front of the box on the z-axis.</param>
		/// <param name="back">Position of the back of the box on the z-axis.</param>
		/// <param name="data">Array of data.</param>
		/// <param name="startIndex">Index of the first element to get.</param>
		/// <param name="elementCount">Number of elements to get.</param>
		public void GetData<T>(int level, int left, int top, int right, int bottom, int front, int back, T[] data, int startIndex, int elementCount) where T : struct
		{
		}

		/// <summary>
		/// Sets 3D texture data.
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="data">Array of data.</param>
		public void SetData<T>(T[] data) where T : struct
		{
			int length;
			if (data != null)
			{
				length = data.Length;
			}
			else
			{
				length = 0;
			}
			this.SetData<T>(0, 0, 0, this.Width, this.Height, 0, this.Depth, data, 0, length);
		}

		/// <summary>
		/// Sets 3D texture data, specifying a start index and number of elements.
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="data">Array of data.</param>
		/// <param name="startIndex">Index of the first element to set.</param>
		/// <param name="elementCount">Number of elements to set.</param>
		public void SetData<T>(T[] data, int startIndex, int elementCount) where T : struct
		{
			this.SetData<T>(0, 0, 0, this.Width, this.Height, 0, this.Depth, data, startIndex, elementCount);
		}

		/// <summary>
		/// Sets 3D texture data, specifying a mipmap level, source box, start index, and number of elements.
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="level">Mipmap level.</param>
		/// <param name="left">X coordinate of the left face of the 3D bounding cube.</param>
		/// <param name="top">Y coordinate of the top face of the 3D bounding cube.</param>
		/// <param name="right">X coordinate of the right face of the 3D bounding cube.</param>
		/// <param name="bottom">Y coordinate of the bottom face of the 3D bounding cube.</param>
		/// <param name="front">Z coordinate of the front face of the 3D bounding cube.</param>
		/// <param name="back">Z coordinate of the back face of the 3D bounding cube.</param>
		/// <param name="data">Array of data.</param>
		/// <param name="startIndex">Index of the first element to set.</param>
		/// <param name="elementCount">Number of elements to set.</param>
		public void SetData<T>(int level, int left, int top, int right, int bottom, int front, int back, T[] data, int startIndex, int elementCount) where T : struct
		{
		}
		#endregion
	}
}
